cmake_minimum_required(VERSION 3.15)

set(CMAKE_CXX_STANDARD 17)

#工程名
SET(PROJECT_NAME "demo_ddA5")
project(${PROJECT_NAME})

macro(add_source name dir)
	include_directories(${dir})
	set(hfind ${ARGV1})
	string(APPEND hfind "/*.h")
	set(cppfind ${ARGV1})
	string(APPEND cppfind "/*.cpp")
	set(cfind ${ARGV1})
	string(APPEND cfind "/*.c")
	file(GLOB name_header ${hfind})
	file(GLOB name_cpp ${cppfind})
	file(GLOB name_c ${cfind})
	set(sourcfiles ${sourcfiles}  ${name_header} ${name_cpp} ${name_c})
	source_group(${ARGV0} FILES  ${name_header} ${name_cpp} ${name_c})
endmacro(add_source)

if(WIN32)
	add_definitions("-D_CRT_SECURE_NO_WARNINGS")
	add_definitions("-DWINDOWSCODE")

	#设置SAFESEH为NO
	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
	set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
endif()


add_definitions("-DFMT_HEADER_ONLY")
add_definitions("-DSPDLOG_FMT_EXTERNAL")

#设置输出路径
message("PROJECT_SOURCE_DIR = " ${PROJECT_SOURCE_DIR})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/run)

include_directories(../../common)

add_source(src ./src)
add_source(fixapi ./fixapi)
add_source(json ../../ThirdPart/jsoncpp)

link_directories(${PROJECT_SOURCE_DIR}/fixapi)

add_executable(${PROJECT_NAME} ${sourcfiles})

target_link_libraries(${PROJECT_NAME} libfixapi.so)

